#pragma once

#include "GEnginePCH.h"

class D3DApp
{

public:
	D3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP);
	virtual ~D3DApp();
	virtual void Render() {}
	virtual void InvalidateDeviceObjects() {};
	virtual void RestoreDeviceObjects() {};

	virtual void initMainWindow();
	virtual void initDirect3D();
	virtual int run();
	virtual LRESULT msgProc(UINT msg, WPARAM wParam, LPARAM lParam);
	
	bool isDeviceLost();

protected:
	std::string mMainWndCaption;
	D3DDEVTYPE  mDevType;
	DWORD       mRequestedVP;
	const int	fullscreen;
	// Application, Windows, and Direct3D data members.
	HINSTANCE             mhAppInst;
	HWND                  mhMainWnd;
	IDirect3D9*           md3dObject;
	bool                  mAppPaused;
	D3DPRESENT_PARAMETERS md3dPP;


	POINT ptLastMousePosit;
	POINT ptCurrentMousePosit;
	bool bMousing;
	bool MouseDown;
	float SpinX;
	float SpinY;
};

// Globals for convenient access.
extern D3DApp* gd3dApp;
extern IDirect3DDevice9* d3ddev;